
package com.yimixian.app.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class ValidatedOrder {
    public ValidatedOrder(List<PaymentMethods> paymentMethods, int deliveryOptionId, int bonusId,
            List<DeliveryOptions> deliveryOptions, List<PriceComponents> priceComponents,
            List<Items> items, String priceToPay, List<Bonus> bonus, String orderString,
            List<FreeItems> freeItems,String remainingBalance) {
        this.paymentMethods = paymentMethods;
        this.deliveryOptionId = deliveryOptionId;
        this.bonusId = bonusId;
        this.deliveryOptions = deliveryOptions;
        this.priceComponents = priceComponents;
        this.items = items;
        this.priceToPay = priceToPay;
        this.bonus = bonus;
        this.orderString = orderString;
        this.freeItems = freeItems;
        this.remainingBalance=remainingBalance;
    }

    private List<PaymentMethods> paymentMethods;
    private int deliveryOptionId;
    private int bonusId;
    private List<DeliveryOptions> deliveryOptions;
    private List<PriceComponents> priceComponents;
    private List<Items> items;
    private String priceToPay;
    public String remainingBalance;
    private List<Bonus> bonus;
    private String orderString;
    private List<FreeItems> freeItems;
    public int canPlaceOrder;
    public String cnpoReason = "";

    public String getRemainingBalance() {
        return remainingBalance;
    }

    public void setRemainingBalance(String remainingBalance) {
        this.remainingBalance = remainingBalance;
    }

    public int getDeliveryOptionId() {
        return deliveryOptionId;
    }

    public void setDeliveryOptionId(int deliveryOptionId) {
        this.deliveryOptionId = deliveryOptionId;
    }

    public int getBonusId() {
        return bonusId;
    }

    public void setBonusId(int bonusId) {
        this.bonusId = bonusId;
    }

    public List<DeliveryOptions> getDeliveryOptions() {
        return deliveryOptions;
    }

    public void setDeliveryOptions(List<DeliveryOptions> deliveryOptions) {
        this.deliveryOptions = deliveryOptions;
    }

    public List<PriceComponents> getPriceComponents() {
        return priceComponents;
    }

    public void setPriceComponents(List<PriceComponents> priceComponents) {
        this.priceComponents = priceComponents;
    }

    public List<Items> getItems() {
        return items;
    }

    public void setItems(List<Items> items) {
        this.items = items;
    }

    public String getPriceToPay() {
        return priceToPay;
    }

    public void setPriceToPay(String priceToPay) {
        this.priceToPay = priceToPay;
    }

    public List<Bonus> getBonus() {
        return bonus;
    }

    public void setBonus(List<Bonus> bonus) {
        this.bonus = bonus;
    }

    public String getOrderString() {
        return orderString;
    }

    public void setOrderString(String orderString) {
        this.orderString = orderString;
    }

    public List<FreeItems> getFreeItems() {
        return freeItems;
    }

    public void setFreeItems(List<FreeItems> freeItems) {
        this.freeItems = freeItems;
    }

    public List<PaymentMethods> getPaymentMethods() {
        return paymentMethods;
    }

    public void setPaymentMethods(List<PaymentMethods> paymentMethods) {
        this.paymentMethods = paymentMethods;
    }

    public static class PaymentMethods {
        /**
         * id : WECHAT name : 微信支付（推荐）
         */
        private String id;
        private String name;

        public PaymentMethods(String id, String name) {
            this.id = id;
            this.name = name;
        }

        public void setId(String id) {
            this.id = id;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getId() {
            return id;
        }

        public String getName() {
            return name;
        }
    }

    public static class DeliveryOptions {
        public DeliveryOptions(int id, String name) {
            this.id = id;
            this.name = name;
        }

        /**
         * id : 1 name : 明天中午12点配送
         */
        private int id;
        private String name;

        public void setId(int id) {
            this.id = id;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getId() {
            return id;
        }

        public String getName() {
            return name;
        }
    }

    public static class PriceComponents {
        /**
         * name : 总价格 raw_name : TOTAL_PRICE value : ¥20.5 __COMMENT_value :
         * 价格为完整字符串 __COMMENT_raw_name : 总价需要给出 raw_name 以便高亮显示
         */
        private String name;
        private String rawName;

        public PriceComponents(String name, String rawName, String value) {
            this.name = name;
            this.rawName = rawName;
            this.value = value;
        }

        private String value;

        public String getRawName() {
            return rawName;
        }

        public void setRawName(String rawName) {
            this.rawName = rawName;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public String getValue() {
            return value;
        }

    }

    public static class Items {
        /**
         * price : ¥12.0 count : 2份 name : 大苹果 __COMMENT_value : 价格为完整字符串
         */
        private String price;
        private String count;
        private String name;

        public String getTxtIndent() {
            return textIndent;
        }

        public void setTextIndent(String textIndent) {
            this.textIndent = textIndent;
        }

        private String textIndent;

        public String getItemAttr() {
            return itemAttr;
        }

        public void setItemAttr(String itemAttr) {
            this.itemAttr = itemAttr;
        }

        private String itemAttr;

        public Items(String price, String count, String name,String itemAttr,String textIndent) {
            this.price = price;
            this.count = count;
            this.name = name;
            this.itemAttr=itemAttr;
            this.textIndent=textIndent;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public void setCount(String count) {
            this.count = count;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getPrice() {
            return price;
        }

        public String getCount() {
            return count;
        }

        public String getName() {
            return name;
        }

    }

    public static class Bonus implements Parcelable {
        /**
         * id : 1 duration : 有效期 2015-06-22 到 2015-07-22 title : 一米鲜周末狂欢券 usable
         * : true __COMMENT_usable : 是否可用 sub_title : 满20元减5元 discount : 5
         */
        private int id;
        private String duration;
        private String title;
        private boolean usable;
        private boolean checked = false;
        private String subTitle;

        public Bonus(int id, String duration, String title, boolean usable, boolean checked,
                String subTitle, String discount) {
            this.id = id;
            this.duration = duration;
            this.title = title;
            this.usable = usable;
            this.checked = checked;
            this.subTitle = subTitle;
            this.discount = discount;
        }

        public String getSubTitle() {

            return subTitle;
        }

        public void setSubTitle(String subTitle) {
            this.subTitle = subTitle;
        }

        private String discount;

        public void setId(int id) {
            this.id = id;
        }

        public void setDuration(String duration) {
            this.duration = duration;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public void setChecked(boolean checked) {
            this.checked = checked;
        }

        public void setUsable(boolean usable) {
            this.usable = usable;
        }

        public boolean isChecked() {
            return checked;
        }

        public void setDiscount(String discount) {
            this.discount = discount;
        }

        public int getId() {
            return id;
        }

        public String getDuration() {
            return duration;
        }

        public String getTitle() {
            return title;
        }

        public boolean isUsable() {
            return usable;
        }

        public String getDiscount() {
            return discount;
        }

        public Bonus() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.id);
            dest.writeString(this.duration);
            dest.writeString(this.title);
            dest.writeByte(usable ? (byte) 1 : (byte) 0);
            dest.writeByte(checked ? (byte) 1 : (byte) 0);
            dest.writeString(this.subTitle);
            dest.writeString(this.discount);
        }

        protected Bonus(Parcel in) {
            this.id = in.readInt();
            this.duration = in.readString();
            this.title = in.readString();
            this.usable = in.readByte() != 0;
            this.checked = in.readByte() != 0;
            this.subTitle = in.readString();
            this.discount = in.readString();
        }

        public static final Creator<Bonus> CREATOR = new Creator<Bonus>() {
            public Bonus createFromParcel(Parcel source) {
                return new Bonus(source);
            }

            public Bonus[] newArray(int size) {
                return new Bonus[size];
            }
        };
    }

    public static class FreeItems {
        /**
         * count : 2份 name : (赠)大苹果
         */
        private String count;
        private String name;

        public FreeItems(String count, String name) {
            this.count = count;
            this.name = name;
        }

        public void setCount(String count) {
            this.count = count;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getCount() {
            return count;
        }

        public String getName() {
            return name;
        }
    }

}
